package com.tokenplus.thai.aviewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import com.tokenplus.thai.base.BaseViewModel
import com.tokenplus.thai.anetwork.ApiUserReposity
import com.tokenplus.thai.data.ReqBase

class CoinsViewModel : BaseViewModel() {

    //////////////////////////////////////////
    private val mGetCoinsLiveData = MutableLiveData<ReqBase>()

    val onGetCoinsLiveData =
        Transformations.switchMap(mGetCoinsLiveData) { query ->
            ApiUserReposity.getCoins(this, query)
        }

    fun getCoins(reqBase: ReqBase) {
        mGetCoinsLiveData.value = reqBase
    }
}